<template>
	<view>
		<!-- 底部弹出框 -->
		<view class="popup" v-show="isshowpopup">
			<!-- 关闭弹窗 -->
			<view class="" @click="closePopup">
				<image src="http://one-huoke.oss-cn-hangzhou.aliyuncs.com/6f924202209222017187961.png" mode=""></image>
			</view>
			<view class="">
				<view class="">
					<image src="../../static/text.png" mode=""></image>
				</view>
				<view class="">
					<view class="">
						<view class="">￥49.9</view>
						<view class="">库存：34件</view>
					</view>
					<view class="">会员</view>
					<view class="">一箱，公一袋</view>
				</view>
			</view>
			<!-- 规格 -->
			<view class="">
				<view class="">规格</view>
				<view class="">
					<view class="" v-for="i in 9" :key="i">
						<view @click="selectSpecification(i)" :class="specificationindex == i ? 'selectactive':''"
							class="specification">{{(i+1) * 5}}斤/箱</view>
					</view>
				</view>
			</view>
			<!-- 数量 -->
			<view class="">
				<view class="">数量</view>
				<view class="">
					<view class="" @click="buyNum(0)">-</view>
					<view class="">{{buynum}}</view>
					<view class="" @click="buyNum(1)">+</view>
				</view>
			</view>
		
			<view class="">
				<view class="">立即购买</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"shoppingSpecification",
		data() {
			return {
				
			};
		},
		methods:{
			// 选择规格
			selectSpecification(i) {
				this.specificationindex = i
				this.specification = (i + 1) * 5 + '斤/箱'
			},
			// 购买数量
			buyNum(type) {
				if (type == 0) {
					if (this.buynum == 1) return
					else {
						this.buynum--
					}
				} else {
					this.buynum++
				}
			},
		}
		
	}
</script>

<style lang="scss">
.popup {
		position: fixed;
		bottom: 0;
		background-color: #fff;
		width: 100%;
		height: 1000rpx;
		border-radius: 20rpx;
		padding: 20rpx 0;
		z-index: 11;

		>view:nth-child(1) {
			text-align: right;

			image {
				width: 50rpx;
				height: 50rpx;
				margin-right: 30rpx;
			}
		}

		>view:nth-child(2) {
			display: flex;

			image {
				padding: 0 40rpx;
				width: 180rpx;
				height: 180rpx;
				border-radius: 20rpx;
			}

			>view:nth-child(2) {
				flex: 2;
				padding: 15rpx 30rpx 15rpx 0;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				>view:nth-child(1) {
					display: flex;
					justify-content: space-between;

					>view:nth-child(1) {
						flex: 1;
						font-size: 34rpx;
						font-weight: 700;
					}

					>view:nth-child(2) {
						font-size: 28rpx;
						color: #ccc;
					}
				}

				>view:nth-child(3) {
					font-size: 24rpx;
					color: #ccc;
				}
			}
		}

		>view:nth-child(3) {
			padding: 40rpx;

			>view:nth-child(1) {
				font-size: 30rpx;
			}

			>view:nth-child(2) {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;

				view {
					.specification {
						text-align: center;
						margin: 10rpx 0;
						width: 140rpx;
						border-radius: 50px;
						padding: 18rpx 30rpx;
						font-size: 28rpx;
						color: #888;
						background-color: #f5f5fa;
					}
				}


			}

		}

		>view:nth-child(4) {
			padding: 0 40rpx;
			display: flex;
			justify-content: space-between;

			>view:nth-child(2) {
				display: flex;
				text-align: center;

				>view:nth-child(1) {
					border-radius: 5rpx;
					width: 60rpx;
					height: 60rpx;
					line-height: 60rpx;
					background-color: #eeeef3;
				}

				>view:nth-child(2) {
					border-radius: 5rpx;
					width: 100rpx;
					height: 60rpx;
					line-height: 60rpx;
					background-color: #eeeef3;
					margin: 0 10rpx;
				}

				>view:nth-child(3) {
					border-radius: 5rpx;
					width: 60rpx;
					height: 60rpx;
					line-height: 60rpx;
					background-color: #258f52;
					color: #fff;
				}
			}
		}

		>view:nth-child(5) {
			position: fixed;
			text-align: center;
			bottom: 40rpx;
			left: 7%;
			width: 600rpx;
			border-radius: 50px;
			background-color: #289958;
			padding: 25rpx;
			color: #fff;
		}
	}
</style>